package entity;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import ch.ivyteam.ivy.security.IUser;

@SessionScoped
@ManagedBean
public class MailData {

	private Map<IUser, List<Mail>> mailData;

	public List<Mail> loadMailInboxMail(IUser user) {
		List<Mail> mailList = new ArrayList<Mail>();
		mailList = mailData.get(user);
		List<Mail>inboxMail = new ArrayList<Mail>();
		for (Mail mail : mailList) {
			if(!mail.isDeleted()&& !mail.isDraft()){
				inboxMail.add(mail);
			}
		}

		return inboxMail;
	}

	public Map<IUser, List<Mail>> getMailData() {
		return mailData;
	}

	public void setMailData(Map<IUser, List<Mail>> mailData) {
		this.mailData = mailData;
	}

}
